#include "vsf.h"

// vsfav_unit_t
void vsfav_unit_add_input(struct vsfav_unit_t *unit, struct vsfav_unit_t *input)
{
	if (unit && input && (unit->input->valid_number < unit->input->number))
		unit->input->array[unit->input->valid_number++] = input;
}

// vsfav_dev_t
struct vsfav_unit_t *vsfav_get_unit_byid(struct vsfav_dev_t *dev, uint8_t id)
{
	for (uint8_t i = 0; i < dev->topology.num_of_units; i++)
		if (dev->topology.units[i]->id == id)
			return dev->topology.units[i];
	return NULL;
}
